# Maintainer: Andy Postnikov <apostnikov@gmail.com>
pkgname=php81-pecl-memprof
_extname=memprof
pkgver=3.0.2
pkgrel=0
pkgdesc="fast and accurate memory profiler that can be used to find the cause of memory leaks in PHP 8.1 applications - PECL"
url="https://pecl.php.net/package/memprof"
arch="all !x86 !armv7 !armhf" # tests fail
license="MIT"
depends="php81-common"
makedepends="php81-dev judy-dev bsd-compat-headers"
checkdepends="php81-pecl-xdebug php81-cgi"
source="php-pecl-$_extname-$pkgver.tgz::https://pecl.php.net/get/$_extname-$pkgver.tgz"
builddir="$srcdir/$_extname-$pkgver"

build() {
	phpize81
	./configure --prefix=/usr --with-php-config=php-config81
	make
}

check() {
	# Tests require xdebug extension
	local _depsdir=/usr/lib/php81/modules
	make NO_INTERACTION=1 REPORT_EXIT_STATUS=1 test PHP_TEST_SHARED_EXTENSIONS="
		-d zend_extension=$_depsdir/xdebug.so \
		-d extension=modules/$_extname.so" TESTS=--show-diff
}

package() {
	make INSTALL_ROOT="$pkgdir" install
	local _confdir="$pkgdir"/etc/php81/conf.d
	install -d $_confdir
	echo "extension=$_extname" > $_confdir/$_extname.ini
}

sha512sums="
2d951f2fd54cf074a392e5bffb22cec0d769147951986b26e6e96efc4d7e52b199bfc7964a663b8d94bd530bad566973a56d86395dfe23a7c3aeb086db12783c  php-pecl-memprof-3.0.2.tgz
"
